package com.zjf.carpark.service.impl;


import com.zjf.carpark.dao.ParkPlaceMapper;
import com.zjf.carpark.entities.ParkPlace;
import com.zjf.carpark.service.ParkPlaceService;
import com.zjf.carpark.vo.ParkPlaceVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description:
 * @author: 张建飞
 * @createDate: 2019/12/21
 * @version: 1.0
 */
@Service
public class ParkPlaceServiceImpl extends BaseServiceImpl<ParkPlace> implements ParkPlaceService {
    @Autowired
    private ParkPlaceMapper parkPlaceMapper;

    @Override
    public int selectByNum(String parkPlaceNum) {
        return parkPlaceMapper.selectByNum(parkPlaceNum);
    }

    @Override
    public List<ParkPlace> selectByMsg(ParkPlaceVO parkPlaceVo) {
        if ("".equals(parkPlaceVo.getCarNum())) {
            parkPlaceVo.setCarNum(null);
        }
        if("".equals(parkPlaceVo.getParkPlaceNum())){
            parkPlaceVo.setParkPlaceNum(null);
        }
        if("".equals(parkPlaceVo.getIsEmploy())){
            parkPlaceVo.setIsEmploy(null);
        }
        if("".equals(parkPlaceVo.getDesc())){
            parkPlaceVo.setDesc(null);
        }
        return parkPlaceMapper.selectByMsg(parkPlaceVo);
    }

    @Override
    public int totalCount(ParkPlaceVO parkPlaceVo) {
        return parkPlaceMapper.totalCount(parkPlaceVo);
    }

    @Override
    public List<ParkPlace> selectNormalByMsg(ParkPlaceVO parkPlaceVo) {
        if ("".equals(parkPlaceVo.getCarNum())) {
            parkPlaceVo.setCarNum(null);
        }
        if("".equals(parkPlaceVo.getParkPlaceNum())){
            parkPlaceVo.setParkPlaceNum(null);
        }
        if("".equals(parkPlaceVo.getIsEmploy())){
            parkPlaceVo.setIsEmploy(null);
        }
        return parkPlaceMapper.selectNormalByMsg(parkPlaceVo);
    }

    @Override
    public int totalCountNormal(ParkPlaceVO parkPlaceVo) {
        return parkPlaceMapper.totalCountNormal(parkPlaceVo);
    }

    @Override
    public List<ParkPlace> selectAllFixed() {
        return parkPlaceMapper.selectAllFixed();
    }

    @Override
    public int updateByNum(String parkPlaceNum, String carNum) {
        return parkPlaceMapper.updateByNum(parkPlaceNum,carNum);
    }

    @Override
    public int inUpdateParkPlace(String carNum, String parkPlaceNum) {
        return parkPlaceMapper.inUpdateParkPlace(carNum, parkPlaceNum);
    }

    @Override
    public int outUpdateParkPlace(String carNum) {
        return parkPlaceMapper.outUpdateParkPlace(carNum);
    }

    @Override
    public int emptyCount() {
        return parkPlaceMapper.emptyCount();
    }

    @Override
    public String selectNormalPark() {
        return parkPlaceMapper.selectNormalPark();
    }

    @Override
    public String selectParkPlaceByCarNum(String carNum) {
        return parkPlaceMapper.selectParkPlaceByCarNum(carNum);
    }

    @Override
    public List<ParkPlace> selectAllParkPlace() {
        return parkPlaceMapper.selectAllParkPlace();
    }

    @Override
    public List<String> selectEmploy() {
        return parkPlaceMapper.selectEmploy();
    }

}
